Tootsville::With-Cluster-Wide-Lock-Held

Macro

With-Cluster-Wide-Lock-Held names a macro, with lambda list ((LOCK-STRING &KEY (TIMEOUT) (IF-NOT-LOCKED)) &BODY BODY):

Execute BODY in a dynamic context owning database lock LOCK-STRING.

LOCK-STRING is passed to the MariaDB server and a global lock by that name is obtained via mySQL function GET_LOCK(STRING), if possible.

If the lock is busy, IF-NOT-LOCKED determines the next action.

:WAIT

Wait for up to TIMEOUT seconds for the lock to be freed. If the lock cannot be obtained within TIMEOUT seconds, signal an error of type CLUSTER-WIDE-LOCK-BUSY-ERROR. If TIMEOUT is NIL, wait indefinitely until the lock can be obtained.

:SKIP

Skip BODY and return NIL.

:WARN

Signal a warning of type CLUSTER-WIDE-LOCK-BUSY-WARNING, then skip BODY and return NIL.

:ERROR

Signal an error of type CLUSTER-WIDE-LOCK-BUSY-ERROR.

Returns the values of BODY.

File

Defined in file src/db/maria.lisp.